package com.mumulx.check.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/*  测试规则信息
 *  Created by IntelliJ IDEA.
 *  User: 木木
 *  Date: 2020/4/25
 *  Time: 20:24
 */
@Getter
@Setter
@ToString
@ApiModel(value = "com.mumulx.check.model.Rule",description = "测试规则信息")
public class Rule implements Serializable {

    @ApiModelProperty(value = "roleid主键")
    private Integer ruleId;

    @ApiModelProperty(value = "测试规则中文名")
    private String ruleName;

    @ApiModelProperty(value = "测试规则父级id")
    private Integer parentId;

    @ApiModelProperty(value = "测试规则树状路径")
    private String rulePath;

    @ApiModelProperty(value = "测试规则是否可用")
    private Boolean enabled;

    @ApiModelProperty(value = "测试规则是否为根节点")
    private Boolean isParent;

    @ApiModelProperty(value = "测试规则英文名称")
    private String englishName;

    @ApiModelProperty(value = "测试规则在nx中的测试规则")
    private String checker;

    @ApiModelProperty(value = "测试规则子节点")
    private List<Rule> children = new ArrayList<>();

    @Override
    public boolean equals(Object o) {

        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Rule that = (Rule) o;
        return Objects.equals(ruleName, that.ruleName);
    }

    @Override
    public int hashCode() {

        return Objects.hash(ruleName);
    }
}
